<template>
  <div>
    <el-card class="box-card">
      <h3>新建小区</h3>
    </el-card>
    <el-card style="margin-top: 20px">
      <span>基础信息</span>
      <div>
        <el-form
          label-position="right"
          label-width="80px"
          :model="forms"
          style="width: 400px; margin-left: 400px; margin-top: 40px"
        >
          <el-form-item label="小区名称">
            <el-input v-model="forms.communityName"></el-input>
          </el-form-item>
          <el-form-item label="详细地址">
            <el-input v-model="forms.address"></el-input>
          </el-form-item>
          <el-form-item label="建成日期">
            <el-date-picker
              type="datetime"
              v-model="forms.builtTime"
              placeholder="选择日期时间"
                value-format="yyyy-MM-dd HH:mm:ss"
            >
            </el-date-picker>
            <!-- <el-input v-model="formLabelAlign.type"></el-input> -->
          </el-form-item>
          <el-form-item label="房屋用途">
            <el-select clearable style="width: 100%"  v-model="forms.houseUse" placeholder="请选择">
              <el-option label="普通住宅" value="普通住宅"></el-option>
              <el-option label="商业用地" value="商业用地"></el-option>
              <el-option label="商住两用" value="商住两用"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="小区面积">
            <el-input v-model="forms.plotArea"></el-input>
          </el-form-item>
          <el-form-item label="楼栋数量">
            <el-input v-model="forms.buildingSum"></el-input>
          </el-form-item>
          <el-form-item label="停车车位">
            <el-input v-model="forms.temporaryCarSum"></el-input>
          </el-form-item>
        </el-form>

        <div style="margin-left: 550px">
          <el-button type="primary" @click="addCommunity">提交</el-button>
          <el-button style="margin-left: 50px" type="primary">重置</el-button>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      forms: {
        communityName: "",
        address: "",
        builtTime: "",
        houseUse: "",
        plotArea: "",
        buildingSum: "",
        temporaryCarSum: "",
      },
      building: [],
    };
  },
  created() {
    this.load();
  },
  methods: {
    addCommunity() {
      console.log(this.forms);
      this.$axios.post("/serverzc/plot/addcommunity", this.forms).then((res) => {
        this.$router.push({
          path: "/plot",
        });
      });
    },
  },
};
</script>

<style scoped>
</style>